﻿@using System.Data.Entity.Design.PluralizationServices;
@using System.Globalization;
@using Orchard.ContentManagement
@using Orchard.Mvc.Html
@using Orchard.Utility.Extensions;
@using System.Linq;
@{
    string title = Model.Title != null ? Model.Title : Model.ContentItem.Tasacion.Tasacion;
    bool isLink = Model.DisplayAsLink;
    string name = Model.ContentField.DisplayName;
    ContentItem item = Model.ContentField.ContentItem != null ? Model.ContentField.ContentItem : Model.ContentItem;

    var pluralService = PluralizationService.CreateService(new CultureInfo("en-US"));
    string pluralContentTypeName = pluralService.Pluralize(name);

    string menuid = "8236"; //Warning Siempre coge el mismo menu y el mismo nombre de aplicación
    string path = "/OrchardLocal/#/"+menuid+"/"+pluralContentTypeName+"/View/"+Model.ContentField.Value;
      
    <span class="control-label">@name</span>
    <div class="controls">
        @if (isLink) {
            <a href="@path">@Html.Raw(title)</a>
        }
        else {
            <span class="control-text">@Html.Raw(title)</span>
        }
    </div>
}